<template>
  <div class="popularity">
    <div
      class="popularity_box"
      v-for="(item, index) in popularity"
      :key="index"
      @click="onClick(item.id)"
    >
      <div class="popularity_box_top">
        <img :src="item.pic" alt="" />
      </div>
      <div class="popularity_box_bottom">
        <p class="popularity_box_bottom_p1">{{ item.name }}</p>
        <p class="popularity_box_bottom_p2">￥{{ item.minPrice }}</p>
        
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    popularity: {
      type: Array,
      required: true,
    },
  },
  methods: {
    onClick(id) {
      console.log(id);
      this.$router.pushRouteByQuery("/popularityDetails", { id: id });
      
    },
  },
};
</script>

<style scoped>
.popularity {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.popularity_box {
  width: 48%;
  height: 280px;
}
.popularity_box_top {
  width: 100%;
}
.popularity_box_top img {
  width: 100%;
  height: 220px;
}
.popularity_box_bottom_p1 {
  font-size: 14px;
  color: gray;
}
.popularity_box_bottom_p2 {
  font-size: 10px;
  color: red;
}
</style>